//
//  MainMenuSectionHeaderView.swift
//  Wmsmobile
//
//  Created by Nick xu on 16/7/27.
//  Copyright © 2016年 hddden. All rights reserved.
//

import UIKit


class MainMenuSectionHeaderView: UICollectionReusableView {
    
    var model:YunCangModel?{
        didSet{
            infoButton?.setTitle(model?.FCAPTION, for: UIControlState())
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.addSubview(infoButton!)
        self.addSubview(button!)
        self.addSubview(label!)
        self.addSubview(lbutton!)
        self.addSubview(leftlabel!)
        self.backgroundColor = UIColor.hexStringToUIColor("#eeeeee")
        self.infoButton?.snp.makeConstraints({ (make) in
//            make.left.equalTo(self).offset(100)
            make.centerX.equalTo(self)
            make.top.equalTo(self).offset(YunCangCollectionSpace)
            make.bottom.equalTo(self).offset(-YunCangCollectionSpace)
        })
        self.button?.snp.makeConstraints({ (make) in
            make.trailing.equalTo(self.infoButton!).offset(13)
            make.top.equalTo(self).offset(YunCangCollectionSpace)
            make.bottom.equalTo(self).offset(-YunCangCollectionSpace)
        })
        self.label?.snp.makeConstraints({ (make) in
            make.trailing.equalTo(self.button!).offset(29)
            make.centerY.equalTo(self)
            make.width.equalTo(25)
            make.top.equalTo(self).offset(YunCangCollectionSpace+12.25)
            make.bottom.equalTo(self).offset(-YunCangCollectionSpace-12.25)
        })
        self.lbutton?.snp.makeConstraints({ (make) in
            make.leading.equalTo(self.infoButton!).offset(-13)
            make.top.equalTo(self).offset(YunCangCollectionSpace)
            make.bottom.equalTo(self).offset(-YunCangCollectionSpace)
        })
        self.leftlabel?.snp.makeConstraints({ (make) in
            make.leading.equalTo(self.lbutton!).offset(-29)
            make.centerY.equalTo(self)
            make.width.equalTo(25)
            make.top.equalTo(self).offset(YunCangCollectionSpace+12.25)
            make.bottom.equalTo(self).offset(-YunCangCollectionSpace-12.25)
        })
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    lazy fileprivate var infoButton:UIButton? = {
        let bt = UIButton()
        bt.titleLabel?.font = UIFont.boldSystemFont(ofSize: 14)
        bt.setTitleColor(UIColor.hexStringToUIColor("#666666"), for: UIControlState())
        return bt
    }()
    
    lazy fileprivate var button:UIButton? = {
        let bt = UIButton()
        bt.titleLabel?.font = UIFont.boldSystemFont(ofSize: 14)
        bt.setImage(UIImage.init(named: "椭圆-灰"), for: UIControlState())
        bt.setTitleColor(UIColor.hexStringToUIColor("#666666"), for: UIControlState())
        return bt
    }()
    lazy fileprivate var label:UILabel? = {
        let bt = UILabel()
        bt.backgroundColor = UIColor.hexStringToUIColor("#999999")
        return bt
    }()
    lazy fileprivate var lbutton:UIButton? = {
        let bt = UIButton()
        bt.titleLabel?.font = UIFont.boldSystemFont(ofSize: 14)
        bt.setImage(UIImage.init(named: "椭圆-灰"), for: UIControlState())
        bt.setTitleColor(UIColor.hexStringToUIColor("#666666"), for: UIControlState())
        return bt
    }()
    lazy fileprivate var leftlabel:UILabel? = {
        let bt = UILabel()
        bt.backgroundColor = UIColor.hexStringToUIColor("#999999")
        return bt
    }()
}
